﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI.WebControls;
using System.Xml.Linq;

/// <summary>
/// Summary description for XML_ProductHot
/// </summary>
public static class XML_ProductHot
{
    public static List<ListItem> GetData()
    {
        List<ListItem> list = new List<ListItem>();
        try
        {
            XElement xItems = XElement.Load(MyConfig.serverPath + "XML/ProductHot.xml");
            var Items = xItems.Descendants("Item");
            foreach (XElement item in Items)
            {
                list.Add(new ListItem(item.Element("Name").Value, item.Element("Id").Value));
            }
        }
        catch { }
        return list;
    }
    public static string GetById(string id)
    {
        string name = "";
        XElement xItems = XElement.Load(MyConfig.serverPath + "XML/ProductHot.xml");
        var Items = xItems.Descendants("Item");
        foreach (XElement item in Items)
        {
            if (item.Element("Id").Value == id)
            {
                name = item.Element("Name").Value;
                break;
            }
        }
        return name;
    }
}